package com.demo.kits;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

public class FileKit {

	@SuppressWarnings("resource")
	public static String getContentFromFile(String path){
		
		BufferedReader br=null;
		StringBuffer sb = new StringBuffer();
		try {
			br=new BufferedReader(new InputStreamReader(new FileInputStream(path),"UTF-8"));  
			String data = br.readLine();//һ�ζ���һ�У�ֱ������nullΪ�ļ�����  
			while( data!=null){  
			      sb.append(data);
			      data = br.readLine(); //���Ŷ���һ��  
			} 
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return sb.toString(); 
	}
}
